#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time

def selectTypeAndPublish(browser):
    Category(browser,'动漫水杯/居家/百货')
    #搜索类目
    searchCategory(browser)
    #发布产品
    clickPublishGoods(browser)

#类目搜索
def Category(browser,productType):
    browser.find_element_by_css_selector("[placeholder='类目搜索：可输入产品名称']").send_keys(productType)

#点击搜索
def searchCategory(browser):
    browser.find_element_by_xpath("//*[@id='struct-search']/div/button").click()
    time.sleep(2)
    #获取第一条的数据
    browser.find_element_by_xpath("/html/body/div[8]/div/ul/li[1]").click()

#点击发布按钮
def clickPublishGoods(browser):
    browser.find_element_by_xpath('//*[@id="struct-submit"]/button').click()
